//index.js
//获取应用实例
const db =wx.cloud.database()//连接数据库
const app = getApp()

Page({
  data: {
    motto: 'Hello World',
    userInfo: {},
    hasUserInfo: false,
    canIUse: wx.canIUse('button.open-type.getUserInfo'),
    dataobj :""
  },
  //事件处理函数
  bindViewTap: function () {
    wx.navigateTo({
      url: '../introduce/introduce'
    })
  },
  imageLoad: function (e) {
    var _this = this;
    var $width = e.detail.width,
      $height = e.detail.height,
      ratio = $width / $height;
    var viewWidth = 500,
      viewHeight = 500 / ratio;
    this.setData({
      imgwidth: viewWidth,
      imgheight: viewHeight
    })

  },
  getDate(){
  
      db.collection("lxmcomment").doc("cbddf0af60accc3a0b7748a8756aa386").get({
        success:res=>{
          console.log(res)
          this.setData({
            dataobj:res.data
          })
        }
      })
  },
  getUserInfo: function (e) {
    console.log(e)
    app.globalData.userInfo = e.detail.userInfo
    this.setData({
      userInfo: e.detail.userInfo,
      hasUserInfo: true
    })
  }

})
